﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AspNetCs.Common;
using AspNetCs.Bll;
using AspNetCs.Model;
using AspNetCs.Enumerations;
using AspNetCs.Enumerations.Channel_Enum;
public partial class InputPwd : BasePage
{
    protected string ReturnUrl = "";
    protected int id = 0;
    protected void Page_Load(object sender, EventArgs e)
    {


        if (Request["RUrl"] != null)
        {
            ReturnUrl = Request["RUrl"].ToString();
        }

        if (Request["id"] != null)
        {
            id = StringHelper.isNumber_int(Request["id"].ToString());
        }
        if (!Page.IsPostBack)
        {
            ViewState["ReturnUrl"] = Server.UrlDecode(ReturnUrl).Replace("'", "");
            ViewState["id"] = id.ToString();
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string pwd = Txt_Pwd.Text.ToString().Trim();
        memorial_model md = Memorial_Bll.CreateNew.GetModel(StringHelper.isNumber_int(ViewState["id"].ToString()));
        string Encryp = EncryptString.GetEncrypt(pwd);

        if (md.GetPwd == Encryp)
        {
            Cookie.SetObj(Channel_Type.memorial.ToString() + "_" + id.ToString(), 0, id.ToString());
            Response.Write("<script>location.href='" + ViewState["ReturnUrl"].ToString() + "';</script>");
            Response.End();
        }
    }
}
